#ifndef DTHREAD_H
#define DTHREAD_H

#include "libaxel/ak_key_manager.h"
#include "password.h"
#include "qmessagebox.h"
#include "progressthread.h"
#include <stdexcept>

class ProgressThread;
class MainWindow;

using std::runtime_error;

class PasswordCanceled : public runtime_error {
public:
	PasswordCanceled() : runtime_error("") {}
};

class DThread: public ProgressThread {
	ak_master< ak_symmetric_key > _encryption_key;
	ak_keydb* _dbase;
	QString _key_id;
	QString _pass;
	QString _keyFile;
	bool _usePassword;
public:
	DThread(MainWindow* parent, QStringList& files, ak_keydb* dbase, QString& keyFile, bool usePassword);
	~DThread();
protected:
	bool job(QString &fileName);
};

#endif // DTHREAD_H